/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Datos;

import Entidades.Parametros;
import Interfaces.IParametros;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author HOUSE
 */
public class DBParametros implements IParametros{
private Connection connection = new Conexion().getConection();
    @Override
    public boolean IngresarParametros(String color, String letra, String tipoletra, String tamano) {
        Parametros nodo=new Parametros();
        try {
            CallableStatement statement;
            statement = connection.prepareCall("{call agregaprestamo (?,?,?,?)}");
            statement.setInt(1, nodo.getcolor());
            statement.setInt(2, nodo.getletra());
            statement.setInt(2,nodo.gettamano() );
            statement.setInt(3,nodo.gettipoletra());

            statement.executeUpdate();
        } catch (Exception ex) {
            //System.out.println("error al agregar calificaciones");
            ex.printStackTrace();
            return false;
        }
        return true;
    
    }

    @Override
    public Parametros consultaParametros() {
        try {
            CallableStatement statement = connection.prepareCall("{call listacliente()}");
            ResultSet resultSet = statement.executeQuery();
            Parametros nodo1 = new Parametros();
            while (resultSet.next()) {
                

                nodo1.setcolor(resultSet.getInt(1));
                nodo1.setletra(resultSet.getInt(2));
                nodo1.settipoletra(resultSet.getInt(3));
                nodo1.settamano(resultSet.getInt(4));
            }
            return nodo1;
        } catch (SQLException ex) {
            ex.printStackTrace();
            return null;

        }
    }

    @Override
    public boolean ModificaParametros(String color, String letra, String tipoletra, String tamano) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
}
